﻿/**
 * ...
 * @author alijaya
 */
#if flash
package homponex.core;
import flash.display.Sprite;
import heox.Rectangle;

class S9G extends Rectangle
{

	public var view(default, null):Sprite;
	
	private var dTop:Float;
	private var dBottom:Float;
	private var dLeft:Float;
	private var dRight:Float;
	
	public var initRect(default, null):Rectangle;
	public var rect(default, null):Rectangle;
	
	public function new(initRect:Rectangle) 
	{
		super();
		view = new Sprite();
		this.initRect = cast(initRect.clone());
		rect = cast(initRect.clone());
		dTop = 0;
		dBottom = 0;
		dLeft = 0;
		dRight = 0;
	}
	
	private override function update_x()
	{
		view.x = x;
	}
	
	private override function update_y()
	{
		view.y = y;
	}
	
	private override function update_width()
	{
		rect.x = dLeft;
		rect.right = width - dRight;
	}
	
	private override function update_height()
	{
		rect.y = dRight;
		rect.bottom = height - dBottom;
	}
	
}
#end